package com.neusoft.elm.util;

import java.io.IOException;
import java.sql.Connection;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet("/")
public class TestConnDB extends HttpServlet {
	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {

        try {
        	System.out.println("try to connect db elm");
            Connection conn = DBUtil.getConnection();
            response.getWriter().println("successful connection");
            DBUtil.close();
        } catch (Exception e) {
            response.getWriter().println("err：" + e.getMessage());
        }
    }
}